package com.adcc.foc.config;

import com.adcc.foc.utils.Log;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.stereotype.Component;

import java.util.Properties;

@Component
public class AppConfig {

    private Integer passwordInvalid;

    private Integer passwordRemind;

    private Integer limitCount;

    private Integer limitTime;

    private String cron;

    public AppConfig() {
        try{
            Properties properties = new Properties();
            properties.load(this.getClass().getClassLoader().getResourceAsStream("conf.properties"));
            passwordInvalid = Integer.valueOf(properties.getProperty("user.password.invalid"));
            passwordRemind = Integer.valueOf(properties.getProperty("user.password.remind"));
            limitCount = Integer.valueOf(properties.getProperty("login.limit.count"));
            limitTime = Integer.valueOf(properties.getProperty("login.limit.time"));
            cron = properties.getProperty("login.limit.cron");

        }catch (Exception e){
            Log.error(ExceptionUtils.getFullStackTrace(e), AppConfig.class);
        }

    }

    public Integer getPasswordInvalid() {
        return passwordInvalid;
    }

    public void setPasswordInvalid(Integer passwordInvalid) {
        this.passwordInvalid = passwordInvalid;
    }

    public Integer getPasswordRemind() {
        return passwordRemind;
    }

    public void setPasswordRemind(Integer passwordRemind) {
        this.passwordRemind = passwordRemind;
    }

    public Integer getLimitCount() {
        return limitCount;
    }

    public void setLimitCount(Integer limitCount) {
        this.limitCount = limitCount;
    }

    public Integer getLimitTime() {
        return limitTime;
    }

    public void setLimitTime(Integer limitTime) {
        this.limitTime = limitTime;
    }

    public String getCron() {
        return cron;
    }

    public void setCron(String cron) {
        this.cron = cron;
    }
}
